package main

import (
	"encoding/json"
	"log"

	"fish-scaner/binary"
	// "fish-scaner/admin"

	// "fish-scaner/adl/ws"
	// adlWs "fish-scaner/adl/ws"

	"fish-scaner/collect"
	"fish-scaner/zip"

	"gitee.com/AlmondLee/gf-tools/tst"
	"github.com/gogf/gf/container/garray"
	"github.com/gogf/gf/container/gmap"
	"github.com/gogf/gf/encoding/gjson"
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/net/ghttp"
	"github.com/gogf/gf/os/glog"
	"github.com/gogf/gf/util/gconv"
	"github.com/gogf/gflock"
)

// type Controller struct{}
var fishMutexPool *gmap.HashMap

// var ZipMutexPool *gmap.HashMap

type Controller struct{}

// type phpMap map[interface{}]interface{}
type stringJson map[string]interface{}

type registerReq struct {
	Fishdb, Systematics, WillZipDirName string
}

// type ViewFunc func(ghttp.ResponseWriter, *ghttp.Request)
// type ViewFunc func(*ghttp.Request)

type registerRes struct {
	ErrCode    int		   `json:"err_code"`
	ErrMessage interface{} `json:"err_message"`
	Data	   interface{} `json:"data"`
}

func init() {
	fishMutexPool = gmap.New(false)
	// gvalid.CheckMap
	// r.Response.Write(os.Args[1])
}

func returnStdErr(errCode int, errMessage string) *registerRes {
	return &registerRes{
		ErrCode:	1,
		ErrMessage: map[string]string{`std_err`: errMessage},
	}
	// r.Response.Write(os.Args[1])
}

func (c *Controller) Download(r *ghttp.Request) {
	filePath := r.GetString("file_path", ``)
	fileLock := gflock.New(WorkDir + `tmp_files/` + filePath)
	glog.Println(`locked:` + WorkDir + `tmp_files/` + filePath)
	if fileLock.IsLocked() {
		r.Response.WriteJsonExit(stringJson{
			`sorry`: `压缩包仍在打包中`,
		})
	}
	fileLock.RLock()
	// r.SetBuffer(
	// file, err:=gfile.Open(filepath, )
	// OpenWithFlagPerm f func(path string, flag int, perm os.FileMode)
	r.Response.ServeFileDownload(WorkDir + `tmp_files/` + filePath)
	// r.Response.ServeFileDownload(gfile.Basename(WorkDir + `tmp_files/` + filePath))
	// r.Response.Write(gfile.GetBytes(filePath))
	// r.
	glog.Println(`unlock` + WorkDir + `tmp_files/` + filePath)
	err := fileLock.RUnlock()
	if err != nil {
		glog.Println(err)
	}

	// panic(2)
}

func (c *Controller) Panic(r *ghttp.Request) {
	// panic(2)
}

func (c *Controller) Index(r *ghttp.Request) {
	// .Do("SET", key, user)
	// r.
	// rw:=ViewFunc(r)
	// basicAuth(r.Response.Writer, r, gconv.String(r.Get(`user`)), gconv.String(r.Get(`passwd`)))
	// ghttp.ResponseWriter
	// gredis.Redis
	// r.Response.Write(os.Args[1])
	// r.Response.ClearBuffer

}

func adminAuth(r *ghttp.Request) {
	adminPassorwd, err := g.Redis().Do("GET", `admin`)
	if err != nil {
		panic(err)
	}
	log.Println(gconv.String(adminPassorwd))
	// r.SetBasicAuth(`szsys`, `8008208820`)
	if r.BasicAuth(`admin`, gconv.String(adminPassorwd)) {
		r.Middleware.Next()
	} else {
		glog.Println(`--------------------------- root login fail ------------------------------`)
		glog.Println(`Cracker IP address:`, r.GetClientIp())
		glog.Println(`Cracker bodyString:`, r.GetBodyString())

		r.Response.WriteStatus(401)
		r.Response.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`)
	}
}

func basicAuth(r *ghttp.Request) {
	// u := new(user.Entity)
	// log.Println(u)

	// passwd, err := g.Redis().Do("GET", r.Get(`user`))
	users, err := g.Redis().DoVar("GET", `users`)
	if err != nil {
		panic(err)
	}
	usersMap := users.MapStrStr()

	tst.Pl(usersMap)
	// log.Println(passwd)
	// r.SetBasicAuth(`szsys`, `8008208820`)
	// r.SetBasicAuth(`q`, `q`)
	// r.Response.Request.SetBasicAuth(`q`, `q`)
	// r.Response.Request.Server.se
	// if passwd == r.Get(`passwd`, `unar`) {
	// if r.BasicAuth(gconv.String(r.Get(`user`, `user`)), gconv.String(r.Get(`passwd`, `unar`))) {
	for user, pass := range usersMap {
		tst.Pl(user, pass)
		if r.BasicAuth(user, pass) {
			r.Middleware.Next()
			return
		}
	}

	glog.Println(`-----------------------------------------------------------`)

	r.Response.WriteStatus(401)
	r.Response.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`)

}

func wsOutput(command string, inf interface{}) []byte {

	// infBack, err := gjson.Encode(phpMap{command: inf})
	// infBack, err := gjson.Encode(g.NewVar(stringJson{command: inf}))

	glog.Println(`--------------- ws output ---------------`)
	infBack, err := json.Marshal(stringJson{command: inf})
	if err != nil {
		glog.Println(`err JSON Marshal:`, err, `!`)
		// glog.Println(err)
		return []byte(err.Error())
	}
	glog.Println(`--------------- ws output generated ---------------`)
	glog.Println(string(infBack))
	return infBack
	// gredis.Redis
	// r.Response.Write(os.Args[1])
}
func (c *Controller) Ws(r *ghttp.Request) {
	// glog.Println(`sessionId: `, r.Session.Id())

	sessionId := r.GetString("sessionId", ``)
	// glog.Println(`get `, sessionId)
	if sessionId != `` {
		err := r.Session.SetId(sessionId)
		if err != nil {
			glog.Println(err)
		}
		// glog.Println(`setSessionId: `, r.Session.Id())
	}
	// {"name":"Runoob"
	ws, err := r.WebSocket()
	if err != nil {
		glog.Error(err)
		r.Exit()
	}
	inf, _ := gjson.Encode(map[string]string{`sessionId`: r.Session.Id()})

	if err = ws.WriteMessage(1, inf); err != nil {
		return
	}
	// glog.Println(`-------------------------------------------------`)
	// fishName, found := fishLatin.PopRand()
	// if !found {
	// glog.Fatal(`fishLatin.PopRand not found`)
	// }
	// fishName, found := keF.PopRand()
	// if !found {
	// glog.Println(`fishLatin.PopRand not found`)
	// sign := make(chan int)
	// myWs := new(adl.Ws)
	// myWs.Ws = ws
	for {
		msgType, msg, err := ws.ReadMessage()
		if err != nil {
			glog.Println(msgType, string(msg))
			return
		}
		// sign <- 1
		// <-sign
		inf, err := gjson.Decode(msg)
		if err != nil {
			if er := ws.WriteMessage(1, gconv.Bytes(err)); er != nil {
				return
			}
			//	glog.Println(`gjson.Encode(r.Session.Map()):`, err)
			//	return
		}

		mmp := gconv.MapStrStr(inf)
		glog.Println(`mmp:`, mmp)
		// glog.Println(outputFormat)

		// case `c`:
		if _, ok := mmp[`collect`]; ok {
			// stdOutCh := make(chan string)
			// stdOutCh := make(chan map[string]interface{})
			stdErrCh := make(chan error)
			req := gconv.Map(mmp[`collect`])
			glog.Println(`collect:`, req)
			// go collect.Collect(WorkDir, `fishdb`, `ke`, gconv.String(fishName), stdOutCh, stdErrCh)
			collectType := `shu`
			fishName := gconv.String(req[`fishName`])
			if fishName[0] == 'F' {
				collectType = `ke`
			}
			go collect.Collect(WorkDir, gconv.String(req[`fishdb`]), collectType, fishName, ws, stdErrCh)
			// glog.Println(`point1:`, err)
			// outputFormat := strings.ReplaceAll(strings.ReplaceAll(string(<-stdOutCh), "\n", "<br>"), "\"", "")
			stdErr := <-stdErrCh
			if stdErr != nil {
				if err = ws.WriteMessage(1,
					wsOutput(`command`, stringJson{
						"stdErr": stdErr,
						// "pyErrCode": stdOut[`pyErrCode`],
						// "stdOut":	 outputSlice,
					})); err != nil {
					return
				}

			}
			// stdOut := <-stdOutCh
			// outputFormat := strings.ReplaceAll(strings.ReplaceAll(gconv.String(stdOut[`stdOut`]), "\"", ""), "\n{sign:0}\n", `2333`)
			// // glog.Println(`point3:`, err)
			// // glog.Println(outputFormat)
			// outputSlice := gstr.Split(outputFormat, `2333`)

		}
		if _, ok := mmp[`scan`]; ok {
			req := gconv.Map(mmp[`scan`])
			zip.ScanDir(WorkDir+`tmp_files/`+gconv.String(req[`dir`]), gconv.String(req[`file`])+`*`, false, ws)
		}
		if _, ok := mmp[`zip`]; ok {
			// stdOutCh := make(chan string)
			stdErrCh := make(chan error)

			req := gconv.Map(mmp[`zip`])
			glog.Println(`------------------------------ compress route --------------------------------`)
			glog.Println(`zip`, mmp[`zip`])

			// go collect.Collect(WorkDir, `fishdb`, `ke`, gconv.String(fishName), stdOutCh, stdErrCh)
			collectType := `shu`
			fishName := gconv.String(req[`fishName`])
			if fishName[0] == 'F' {
				collectType = `ke`
			}
			go zip.Zip(WorkDir, gconv.String(req[`fishdb`]), collectType, fishName, ws, stdErrCh)
			// go collect.Collect(WorkDir, `fishdb`, `ke`, gconv.String(fishName), make(chan string))
			// go collect.Collect(WorkDir, `fishdb`, `shu`, gconv.String(fishName), stdOutCh)
			// go zip.Zip(WorkDir, `fundiving`, `ke`, gconv.String(`Chirocentrus dorab`), stdOutCh, stdErrCh)
			// go zip.Zip(WorkDir, `fishdb`, `shu`, gconv.String(`Chirocentrus dorab`), stdOutCh, stdErrCh)
			// go zip.Zip(WorkDir, `fundiving`, `ke`, gconv.String(fishName), stdOutCh, stdErrCh)
			// go zip.Zip(WorkDir, `fishdb`, `shu`, gconv.String(req[`fishName`]), stdOutCh, stdErrCh)
			// go zip.Zip(WorkDir, `fishdb`, `shu`, gconv.String(req[`fishName`]), ws, stdErrCh)
			stdErr := <-stdErrCh
			// stdOut := <-stdOutCh
			if stdErr != nil {
				glog.Println(err)
				if err = ws.WriteMessage(1,
					wsOutput(`command`, stringJson{
						"stdErr": stdErr,
						// "stdOut": stdOut,
					})); err != nil {
					return
				}
			}
		}

	}
	// for {
	// <-sign
	// if err = ws.WriteMessage(msgType, msg); err != nil {
	// if err = ws.WriteMessage(1, pip(`bs4`)); err != nil {
	// return
	// }
	// }
}

func (c *Controller) Wsml(r *ghttp.Request) {
	// s.SetServerRoot("/www/wwwroot/ws.seafishery.com")
	// ctr := new(Controller)

	// s.BindHandler("/api/ok", func(r *ghttp.Request) {
	// r.Response.WriteExit(`ok`)
	// })
	// s.BindHandler("/ws.html", func(r *ghttp.Request) {
	// r.Response.WriteExit(binary.Binary[`ws.html`].String())
	// })
	r.Response.Write(binary.Binary[`ws.html`])
}

func (c *Controller) Test(r *ghttp.Request) {
	log.Print("\n\n\n\n\n")
	// fishdb := `fishdb/`
	// willZipDirName = `Okamejei meerdervoortii`
	var req *registerReq
	if err := r.Parse(&req); err != nil {
		r.Response.WriteJsonExit(returnStdErr(1, err.Error()))
	}
	// log.Println(registerReq.systematics)
	// json
	// collect.Collect(WorkDir, fishdb, systematics, willZipDirName)
	// dir := os.Args[1] + "/demo/"
	// files := r.GetUploadFiles("will_run_img")
	// names, err := files.Save(dir)
	// if err != nil {
	// r.Response.WriteExit(err)
	// }

	// gfile.Remove(dir + names[0])

	// r.Response.WriteJsonExit(*req)
	r.Response.WriteJsonExit(registerRes{
		Data: req,
	})
	// g.Map{
	// "err_code": 0,
	// "err_message": match[1],
	// "file":		   base64Img,
	// "flie_url": "https://zhai.almondlee.cn/result/" + names[0], //:" + os.Args[2] + "
	// })
	log.Println("end")
}

// func InitRoute() {
// ctr := new(Controller)
// s.BindObject("/api", ctr)

// }
var keF = garray.NewFrom(g.Slice{`F096`, `F097`, `F094`, `F095`, `F084`, `F079`, `F074`, `F081`, `F156`, `F151`, `F506`, `F505`, `F187`, `F048`, `F313`, `F304`, `F245`, `F366`, `F351`, `F474`, `F370`, `F378`, `F355`, `F393`, `F392`, `F331`, `F376`, `F362`, `F412`, `F371`, `F338`, `F475`, `F356`, `F364`, `F374`, `F381`, `F480`, `F481`, `F354`, `F453`, `F365`, `F382`, `F373`, `F414`, `F472`})
var fishLatin = garray.NewFrom(g.Slice{`Dentex abei`, `Lethrinus atkinsoni`, `Lutjanus ehrenbergii`, `Pentapodus emeryii`, `Hapalogenys kishinouyei`, `Diplogrammus xenicus`, `Plectorhinchus picus`, `Sphyraena qenie`, `Kumococius rodericensis`, `Calotomus spinidens`, `Gerres oyena`, `Scomber australasicus`, `Chaetodon octofasciatus`, `Lutjanus bohar`, `Plectorhinchus albovittatus`, `Branchiostegus albus`, `Sardinella albella`, `Carangoides talamparoides`, `Callionymus pleurostictus`, `Anyperodon leucogrammicus`, `Acreichthys tomentosus`, `Gymnothorax albimarginatus`, `Minous pictus`, `Chaetodon punctatofasciatus`, `Amblygaster sirm`, `Drepane punctata`, `Cephalopholis argus`, `Scomberomorus guttatus`, `Herklotsichthys punctatus`, `Arius maculatus`, `Plectorhinchus chaetodonoides`, `Konosirus punctatus`, `Siganus punctatus`, `Branchiostegus auratus`, `Callionymus enneactis`, `Pennahia pawak`, `Sphyraena jello`, `Pterocaesio pisang`, `Okamejei kenojei`, `Myrichthys colubrinus`, `Gymnothorax berndti`, `Nibea semifasciata`, `Lethrinus semicinctus`, `Leiuranus semicinctus`, `Chirocentrus dorab`, `Epinephelus areolatus`, `Enchelycore pardalis`, `Cephalopholis leopardus`, `Chlorurus bowersi`, `Okamejei boesemani`, `Ablabys taenianotus`, `Carangoides dinema`, `Enchelycore bayeri`, `Callionymus beniteguri`, `Enchelycore bikiniensis`, `Pellona ditchela`, `Chaetodon ephippium`, `Lethrinus lentjan`, `Callionymus planus`, `Evoxymetopon poeyi`, `Balistapus undulatus`, `Psenes cyanophrys`, `Gymnothorax buroensis`, `Cymbacephalus beauforti`, `Chaetodon burgessi`, `Ebosia bleekeri`, `Paramonacanthus pusillus`, `Bathyraja trachouros`, `Chelidoperca pleurospilus`, `Malacanthus latovittatus`, `Rhinecanthus aculeatus`, `Synodus macrops`, `Aphareus furca`, `Benthodesmus tenuis`, `Hoplolatilus fronticinctus`, `Chaetodon auripes`, `Belonoperca chabanaudi`, `Chirocentrus nudus`, `Thryssa setirostris`, `Lethrinus genivittatus`, `Gerres filamentosus`, `Gymnocranius elongatus`, `Pentapodus nagasakiensis`, `Thunnus alalunga`, `Siganus canaliculatus`, `Moolgarda cunnesius`, `Equulites elongatus`, `Nemipterus zysron`, `Saurida elongata`, `Hipposcarus longiceps`, `Priacanthus tayenus`, `Paramonacanthus nipponensis`, `Lethrinus miniatus`, `Thysanophrys longirostris`, `Gerres longirostris`, `Gerres oblongus`, `Cephalopholis aurantia`, `Scolopsis ciliata`, `Thryssa kammalensis`, `Epinephelus akaara`, `Nemipterus aurora`, `Lethrinus erythropterus`, `Sardinella zunasi`, `Siganus spinus`, `Parupeneus crassilabris`, `Minous trachycephalus`, `Callionymus scabriceps`, `Pervagor aspricaudus`, `Equulites lineolatus`, `Pomadasys maculatus`, `Bodianus perditio`, `Larimichthys crocea`, `Suggrundus macracanthus`, `Ablabys macracanthus`, `Gerres macracanthus`, `Caranx bucculentus`, `Chelon macrolepis`, `Onigocia macrolepis`, `Netuma thalassina`, `Pennahia macrocephalus`, `Dipturus macrocauda`, `Johnius macrorhynus`, `Sphyraena barracuda`, `Thunnus obesus`, `Grammatorcynus bilineatus`, `Sphyraena forsteri`, `Suggrundus meerdervoortii`, `Siganus unimaculatus`, `Scolopsis monogramma`, `Chaetodermis penicilligerus`, `Aluterus monoceros`, `Monotaxis grandoculis`, `Callionymus filamentosus`, `Minous monodactylus`, `Coilia nasus`, `Rogadius asper`, `Sphyraena putnamae`, `Stolephorus insularis`, `Synodus doaki`, `Bodianus leucosticticus`, `Pomadasys kaakan`, `Parupeneus spilurus`, `Synodus orientalis`, `Sarda orientalis`, `Thunnus orientalis`, `Gymnothorax favagineus`, `Rhinecanthus verrucosus`, `Minous coccineus`, `Johnius dussumieri`, `Thryssa dussumieri`, `Harpadon microchir`, `Trichiurus brevis`, `Leiognathus equulus`, `Dendrochirus brachypterus`, `Ariomma brevimanum`, `Priacanthus macracanthus`, `Lethrinus ornatus`, `Malacanthus brevirostris`, `Parupeneus ciliatus`, `Etelis radiosus`, `Saurida tumbil`, `Upeneus vittatus`, `Parupeneus multifasciatus`, `Echidna polyzona`, `Eleutheronema rhadinum`, `Sillago sihama`, `Choridactylus multibarbus`, `Saurida wanieso`, `Brachysomophis crocodilinus`, `Evynnis cardinalis`, `Alepes vari`, `Coilia mystus`, `Scolopsis vosmeri`, `Rastrelliger faughni`, `Priacanthus sagittarius`, `Chlorurus frontalis`, `Trichiurus lepturus`, `Scarus hypselopterus`, `Carangoides equula`, `Argyrops spinifer`, `Sardinella brachysoma`, `Chaetodon rafflesii`, `Mesopristes cancellatus`, `Synodus dermatogenys`, `Chaetodon lunulatus`, `Chaetodon guentheri`, `Atropus atropos`, `Encrasicholina oligobranchus`, `Dipturus kwangtungensis`, `Carangoides hedlandensis`, `Muraenesox cinereus`, `Callionymus hainanensis`, `Callionymus hindsii`, `Sillago ingenuua`, `Thryssa hamiltonii`, `Okamejei hollandi`, `Anarchias allardicei`, `Synodus fuscus`, `Muraenesox bagio`, `Siganus fuscescens`, `Caesio caerulaurea`, `Balistoides viridescens`, `Helicolenus hilgendorfii`, `Upeneus tragula`, `Parupeneus pleurostigma`, `Scarus globiceps`, `Chaetodon melannotus`, `Eubleekeria splendens`, `Melichthys vidua`, `Rhinecanthus rectangulus`, `Xanthichthys caeruleolineatus`, `Pterocaesio tile`, `Lethrinus harak`, `Pseudobalistes fuscus`, `Atrobucca nibe`, `Gymnothorax chlamydatus`, `Acanthopagrus schlegelii`, `Ilisha melastoma`, `Hapalogenys nigripinnis`, `Siganus punctatissimus`, `Sinobatis melanosoma`, `Pervagor melanocephalus`, `Sardinella melanura`, `Scarus niger`, `Cephalopholis spiloparaea`, `Callionymus martinae`, `Diagramma melanacrum`, `Brachysomophis henshawi`, `Nemipterus furcosus`, `Cheilinus fasciatus`, `Parascolopsis inermis`, `Grammoplites scaber`, `Carangoides plagiotaenia`, `Cephalopholis boenak`, `Synodus ulae`, `Mulloidichthys pfluegeri`, `Aphareus rutilans`, `Synodus rubromarmoratus`, `Lethrinus erythracanthus`, `Lethrinus rubrioperculatus`, `Lutjanus erythropterus`, `Lethrinus haematopterus`, `Pervagor janthinosoma`, `Gerres erythrourus`, `Otolithes ruber`, `Odonus niger`, `Psammoperca waigiensis`, `Bodianus rubrisos`, `Etelis carbunculus`, `Aethaloperca rogaa`, `Opisthopterus tardoore`, `Scarus dimidiatus`, `Plectorhinchus pictus`, `Gymnothorax enigmaticus`, `Dendrochirus zebra`, `Balistoides conspicillum`, `Saurida undosquamis`, `Psenes pellucidus`, `Hilsa kelee`, `Clupanodon thrissa`, `Sardinella hualiensis`, `Anguilla marmorata`, `Plectorhinchus cinctus`, `Chaetodon ornatissimus`, `Hapalogenys analis`, `Cubiceps whiteleggii`, `Nematalosa come`, `Scarus oviceps`, `Photopectoralis bindus`, `Gymnothorax flavimarginatus`, `Lethrinus xanthochilus`, `Upeneus sulphureus`, `Parupeneus chrysopleuron`, `Mulloidichthys flavolineatus`, `Dussumieria elopsoides`, `Pentapodus aureofasciatus`, `Plectorhinchus flavomaculatus`, `Carangoides fulvoguttatus`, `Echidna xanthospilos`, `Nibea albiflora`, `Setipinna tenuifilis`, `Caesio teres`, `Priacanthus zaiserae`, `Sufflamen chrysopterum`, `Acanthopagrus latus`, `Thunnus albacares`, `Thamnaconus hypargyreus`, `Anampses meleagrides`, `Caesio cuning`, `Sphyraena flavicauda`, `Plectorhinchus chrysotaenia`, `Pseudobalistes flavimarginatus`, `Nemipterus thosaporni`, `Sardinella lemuru`, `Ellochelon vaigiensis`, `Gymnocranius griseus`, `Heteropriacanthus cruentatus`, `Scarus fuscocaudalis`, `Bathycallionymus kaianus`, `Alepes djedaba`, `Collichthys lucidus`, `Cantherhines dumerilii`, `Hoplosebastes armatus`, `Carangoides armatus`, `Okamejei acutispina`, `Sphyraena acutipinnis`, `Cheilinus oxycephalus`, `Chrysochir aureus`, `Bodianus oxycephalus`, `Rhynchopelates oxyrhynchus`, `Encrasicholina heteroloba`, `Lates calcarifer`, `Lethrinus olivaceus`, `Oxymonacanthus longirostris`, `Dussumieria acuta`, `Dipturus lanceorostratus`, `Synodus tectus`, `Secutor interruptus`, `Katsuwonus pelamis`, `Sufflamen fraenatum`, `Lutjanus fulvus`, `Oedalechilus labiosus`, `Johnius grypotus`, `Pennahia anea`, `Lethrinus obsoletus`, `Xanthichthys auromarginatus`, `Gnathodentex aureolineatus`, `Pterocaesio chrysozona`, `Photopectoralis aureus`, `Priacanthus hamrur`, `Scatophagus argus`, `Nemipterus virgatus`, `Lutjanus fulviflamma`, `Secutor insidiator`, `Acanthopagrus sivicolus`, `Dipturus gigas`, `Onigocia spinosa`, `Rogadius pristiger`, `Brachypterois serrulata`, `Paraluteres prionurus`, `Rachycentron canadum`, `Apterichtus moseri`, `Anarchias cantonensis`, `Stolephorus commersonnii`, `Scomberomorus commerson`, `Cubiceps kotlyari`, `Alepes kleinii`, `Bascanichthys kirkii`, `Parascolopsis eriomma`, `Channomuraena vittata`, `Gazza achlamys`, `Caranx lugubris`, `Terapon theraps`, `Lutjanus boutton`, `Siganus virgatus`, `Scomberomorus niphonius`, `Aprion virescens`, `Chlorurus sordidus`, `Scarus chameleon`, `Cephalopholis formosa`, `Gymnocranius grandoculis`, `Ilisha elongata`, `Plectorhinchus lessonii`, `Apistus carinatus`, `Sunagocia otaitensis`, `Crenimugil crenilabis`, `Enchelycore schismatorhynchus`, `Johnius distinctus`, `Acanthopagrus chinshira`, `Sorsogona tuberculata`, `Chlorurus oedema`, `Cephalopholis sexmaculata`, `Nemipterus hexodon`, `Helotes sexlineatus`, `Polydactylus sexfilis`, `Polydactylus sextarius`, `Lutjanus gibbus`, `Sardinella gibbosa`, `Harpadon nehereus`, `Secutor ruconius`, `Carangoides oblongus`, `Pterocaesio randalli`, `Gymnosarda unicolor`, `Muraenichthys gymnopterus`, `Carangoides gymnostethus`, `Inegocia ochiaii`, `Upeneus luzonius`, `Anguilla luzonensis`, `Chelon subviridis`, `Scarus forsteni`, `Cheilinus chlorourus`, `Lutjanus malabaricus`, `Carangoides malabaricus`, `Upeneus moluccensis`, `Thamnaconus modestus`, `Pterocaesio marri`, `Hoplolatilus marcosi`, `Chaetodon meyeri`, `Pristigenys meyeri`, `Okamejei meerdervoortii`, `Cirricaecula macdowelli`, `Saurida umeyoshii`, `Gymnothorax eurostus`, `Dendrochirus bellus`, `Gymnothorax elegans`, `Amanses scopas`, `Lutjanus bengalensis`, `Chaetodon citrinellus`, `Diagramma pictum`, `Miichthys miiuy`, `Lamnostoma mindora`, `Callionymus meridionalis`, `Iracundus signifer`, `Trichiurus nanhaiensis`, `Plicofollis nella`, `Thamnaconus modestoides`, `Sardinops sagax`, `Aluterus scriptus`, `Anacanthus barbatus`, `Rogadius patriciae`, `Nemipterus peronii`, `Moolgarda perusii`, `Johnius belangerii`, `Chaetodon modestus`, `Rhabdosargus sarba`, `Carangoides ferdau`, `Amblygaster leiogaster`, `Sinobatis borneensis`, `Plicofollis polystaphylodon`, `Cephalopholis igarashiensis`, `Parupeneus heptacanthus`, `Coilia grayii`, `Bodianus diana`, `Pseudalutarius nasicornis`, `Lutjanus madras`, `Leptoscarus vaigiensis`, `Scarus ghobban`, `Thunnus tonggol`, `Epinephelus awoara`, `Cephalopholis miniata`, `Sardinella jussieu`, `Chaetodon baronessa`, `Nuchequula mannusella`, `Ratabulus megacephalus`, `Pentapodus caninus`, `Argyrosomus japonicus`, `Branchiostegus japonicus`, `Upeneus japonicus`, `Paramonacanthus japonicus`, `Inimicus japonicus`, `Nematalosa japonica`, `Chaetodon nippon`, `Nemipterus japonicus`, `Pristigenys niphonia`, `Notoraja tobitukai`, `Chlorurus japanensis`, `Anguilla japonica`, `Cookeolus japonicus`, `Scomber japonicus`, `Engraulis japonicus`, `Inegocia japonica`, `Sphyraena japonica`, `Calotomus japonicus`, `Gerres japonicus`, `Paramonacanthus sulcatus`, `Anampses geographicus`, `Siganus vermiculatus`, `Lactarius lactarius`, `Enchelynassa canina`, `Scolopsis trilineata`, `Parapristipoma trilineatum`, `Lepturacanthus savala`, `Sunagocia arenicola`, `Acanthocybium solandri`, `Callionymus schaapii`, `Sillago japonica`, `Cubiceps pauciradiatus`, `Plectorhinchus schotaf`, `Synodus jaculum`, `Priacanthus fitchi`, `Nemipterus bathybius`, `Erosa erosa`, `Gerres decacanthus`, `Synodus binotatus`, `Bodianus bimaculatus`, `Parupeneus biaculeatus`, `Diploprion bifasciatum`, `Scolopsis bilineata`, `Pterocaesio digramma`, `Bodianus bilunulatus`, `Protonibea diacanthus`, `Eleutherochir opercularis`, `Dipterygonotus balteatus`, `Cetoscarus bicolor`, `Chaetodon bennetti`, `Aporops bilinearis`, `Dendrochirus biocellatus`, `Inimicus didactylus`, `Nomeus gronovii`, `Stephanolepis cirrhifer`, `Callionymus doryssus`, `Alectis ciliaris`, `Chaetodon auriga`, `Minous pusillus`, `Arius arius`, `Bodianus thoracotaeniatus`, `Etelis coruscans`, `Hoplolatilus starcki`, `Bodianus anthioides`, `Hoplolatilus cuniculus`, `Lutjanus dodecacanthoides`, `Parupeneus barberinoides`, `Congresox talabonoides`, `Argyrops bleekeri`, `Upeneus quadrilineatus`, `Pomadasys quadrilineatus`, `Pelates quadrilineatus`, `Chaetodon quadrimaculatus`, `Herklotsichthys quadrimaculatus`, `Chaetodon plebeius`, `Lutjanus kasmira`, `Eleutheronema tetradactylum`, `Bathyraja matsubarai`, `Sardinella fimbriata`, `Cephalopholis sonnerati`, `Gavialiceps taiwanensis`, `Cirrimaxilla formosa`, `Synodus taiwanensis`, `Acanthopagrus taiwanensis`, `Enchelycore lichenosa`, `Acanthopagrus pacificus`, `Anguilla bicolor pacifica`, `Idiastion pacificum`, `Muraenichthys thompsoni`, `Aulacocephalus temminckii`, `Dipturus tengu`, `Parupeneus barberinus`, `Plectorhinchus vittatus`, `Equulites rivulatus`, `Plectorhinchus lineatus`, `Drepane longimana`, `Scolopsis taenioptera`, `Gymnomuraena zebra`, `Evoxymetopon taeniatus`, `Allips concolor`, `Scarus ovifrons`, `Parascolopsis tosensis`, `Johnius amblycephalus`, `Plectorhinchus gibbosus`, `Cromileptes altivelis`, `Bolbometopon muricatum`, `Callionymus valenciennei`, `Callionymus curvicornis`, `Chaetodon reticulatus`, `Lethrinus reticulatus`, `Scarus frenatus`, `Stolephorus waitei`, `Cephalopholis urodeta`, `Euthynnus affinis`, `Scolopsis affinis`, `Anampses melanurus`, `Mulloidichthys vanicolensis`, `Ectreposebastes imus`, `Bodianus tanyokidus`, `Minous quincarinatus`, `Pentaprion longimanus`, `Polydactylus plebeius`, `Anguilla celebesensis`, `Thysanophrys celebica`, `Filimanus sealei`, `Gymnothorax fimbriatus`, `Cantherhines pardalis`, `Oxyconger leptognathus`, `Terapon jarbua`, `Sillago parvisquamis`, `Saurida gracilis`, `Leiognathus berbis`, `Chaetodon lineolatus`, `Tentoriceps cristatus`, `Xanthichthys lineopunctatus`, `Scolopsis lineata`, `Plotosus lineatus`, `Epinephelus amblycephalus`, `Chaetodon adiergastos`, `Nuchequula nuchalis`, `Sufflamen bursa`, `Chlorurus microrhinos`, `Gymnocranius microdon`, `Lethrinus microdon`, `Larimichthys polyactis`, `Polydactylus microstomus`, `Etrumeus micropus`, `Echelus uropterus`, `Gazza minuta`, `Sillago microps`, `Lutjanus decussatus`, `Bodianus loxozonus`, `Anampses neoguinaicus`, `Chaetodon lunula`, `Caesio lunaris`, `Sardinella sindensis`, `Anampses twistii`, `Siganus guttatus`, `Lethrinus nebulosus`, `Abalistes stellaris`, `Calotomus carolinus`, `Lutjanus carponotatus`, `Brachysomophis cirrocheilos`, `Muraenichthys schultzei`, `Caprodon schlegelii`, `Moolgarda seheli`, `Sillago asiatica`, `Sciaenops ocellatus`, `Siganus puellus`, `Mene maculata`, `Chelidoperca hirundinacea`, `Synodus capricornis`, `Lipocheilus carnolabrum`, `Equulites leuciscus`, `Bodianus axillaris`, `Bodianus izuensis`, `Bodianus masudai`, `Branchiostegus argentatus`, `Pennahia argentata`, `Encrasicholina punctifer`, `Siganus argenteus`, `Chaetodon argentatus`, `Mesopristes argenteus`, `Pomadasys argenteus`, `Stolephorus indicus`, `Parupeneus indicus`, `Alectis indica`, `Ariomma indicum`, `Secutor indicius`, `Anampses caeruleopunctatus`, `Platycephalus indicus`, `Atule mate`, `Canthidermis maculata`, `Rastrelliger kanagurta`, `Parupeneus cyclostomus`, `Bodianus cylindriatus`, `Nematalosa nasus`, `Gerres limbatus`, `Lutjanus johnii`, `Lutjanus lunulatus`, `Callechelys marmorata`, `Gymnothorax chilospilus`, `Echidna nebulosa`, `Saurida nebulosa`, `Bathyraja isotrachys`, `Synodus variegatus`, `Lethrinus variegatus`, `Sillago aeolus`, `Scarus festivus`, `Thysanophrys chiltonae`, `Scomberomorus koreanus`, `Siganus javus`, `Caranx ignobilis`, `Pagrus major`, `Gymnocranius euanus`, `Lutjanus lutjanus`, `Thryssa chefuensis`, `Carangoides orthogrammus`, `Dactylopus dactylopus`, `Gerres shima`, `Monacanthus chinensis`, `Inimicus sinensis`, `Scomberomorus sinensis`, `Cirrhimuraena chinensis`, `Bodianus mesothorax`, `Scolopsis margaritifera`, `Chaetodon kleinii`, `Mugil cephalus`, `Lutjanus argentimaculatus`, `Brachysomophis porphyreus`, `Hoplolatilus purpureus`, `Upeneus subvittatus`, `Cantherhines fronticinctus`})
